﻿using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace iOSForLife.Data.Migrations
{
    /// <inheritdoc />
    public partial class UserDataModel : Migration
    {
        /// <inheritdoc />
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropForeignKey(
                name: "FK_ClipboardModel_Users_UserId",
                table: "ClipboardModel");

            migrationBuilder.DropPrimaryKey(
                name: "PK_ClipboardModel",
                table: "ClipboardModel");

            migrationBuilder.RenameTable(
                name: "ClipboardModel",
                newName: "Clipboard");

            migrationBuilder.RenameIndex(
                name: "IX_ClipboardModel_UserId",
                table: "Clipboard",
                newName: "IX_Clipboard_UserId");

            migrationBuilder.AddPrimaryKey(
                name: "PK_Clipboard",
                table: "Clipboard",
                column: "Id");

            migrationBuilder.CreateTable(
                name: "UserDataModel",
                columns: table => new
                {
                    UserId = table.Column<string>(type: "varchar(10)", nullable: false),
                    EducationalPassword = table.Column<string>(type: "varchar(64)", nullable: false),
                    AuthenticationPassword = table.Column<string>(type: "varchar(64)", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_UserDataModel", x => x.UserId);
                    table.ForeignKey(
                        name: "FK_UserDataModel_Users_UserId",
                        column: x => x.UserId,
                        principalTable: "Users",
                        principalColumn: "UserId",
                        onDelete: ReferentialAction.Cascade);
                });

            migrationBuilder.AddForeignKey(
                name: "FK_Clipboard_Users_UserId",
                table: "Clipboard",
                column: "UserId",
                principalTable: "Users",
                principalColumn: "UserId",
                onDelete: ReferentialAction.Cascade);
        }

        /// <inheritdoc />
        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropForeignKey(
                name: "FK_Clipboard_Users_UserId",
                table: "Clipboard");

            migrationBuilder.DropTable(
                name: "UserDataModel");

            migrationBuilder.DropPrimaryKey(
                name: "PK_Clipboard",
                table: "Clipboard");

            migrationBuilder.RenameTable(
                name: "Clipboard",
                newName: "ClipboardModel");

            migrationBuilder.RenameIndex(
                name: "IX_Clipboard_UserId",
                table: "ClipboardModel",
                newName: "IX_ClipboardModel_UserId");

            migrationBuilder.AddPrimaryKey(
                name: "PK_ClipboardModel",
                table: "ClipboardModel",
                column: "Id");

            migrationBuilder.AddForeignKey(
                name: "FK_ClipboardModel_Users_UserId",
                table: "ClipboardModel",
                column: "UserId",
                principalTable: "Users",
                principalColumn: "UserId",
                onDelete: ReferentialAction.Cascade);
        }
    }
}
